<?php
if(!isset($_SESSION))
    session_start();
?>
<?php
if(isset($_SESSION['uname']))
    $uname = $_SESSION['uname'];
else
    header("Location: http://192.168.1.205:8888/homepage.php");  
?>
<html>
<head> 
<title>乔这一家子论坛登陆(qiao.com)</title> 
</head>
<body>
<?php
$answer =$_POST['anser'];
$name1 = $_GET['name'];
if($name1 == NULL){
  $name1 =$_POST['name2'];
  $name1;
}
if($name1 == NULL){
  echo $name1;
}
require_once '20161010_1.php';
if ($answer != NULL){
$sq = "INSERT INTO anserinfo(topic_title,topic_pasage,topic_man,birth_date) VALUES ('$name1','$answer','$uname',NOW())";
mysqli_query($conn,$sq);}
$sql = "SELECT * from topicinfo WHERE topic_title='$name1'";
if ($result=mysqli_query($conn,$sql))
{
	// 一条条获取
	while ($row=mysqli_fetch_row($result))
	{
          echo $row[1];
	  echo "<br>";
	  echo $row[2];
	  echo "<br>";
	  echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;by$row[3]于$row[4]";
	    }
          mysqli_free_result($result);
}
$sql2 = "SELECT * from anserinfo WHERE topic_title='$name1'";
if ($result2=mysqli_query($conn,$sql2))
{
	// 一条条获取
	while ($row2=mysqli_fetch_row($result2))
	{
          echo $row2[1];
	  echo "<br>";
	  echo $row2[2];
	  echo "<br>";
	  echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;by$row2[3]于$row2[4]";
	    }
          mysqli_free_result($result2);
}
mysqli_close($conn);
?>
<form name="input" action="answer.php" method="post">
回复内容:<textarea rows="10" cols="30px" name="anser"></textarea>
  <input type="hidden" name="name2" value="<?php echo $name1;?>">
<input type="submit" value="回复">
</form>
</body>
</html>